<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:18:23 GMT -->

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>经销商管理后台</title>
    <meta name="keywords" content="对账接入者管理系统">
    <meta name="description" content="对账接入者管理系统">

    <link rel="shortcut icon" href="{{asset('dealer/img/xbblogo.ico')}}">
    <link href="{{asset('dealer/css/bootstrap.min.css')}}" rel="stylesheet">
    <link href="{{asset('dealer/css/font-awesome.min.css')}}" rel="stylesheet">

    <link href="{{asset('dealer/css/animate.min.css')}}" rel="stylesheet">
    <link href="{{asset('dealer/css/style.min.css')}}" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <!--
        <div style="width:300px;height:186px;overflow:hidden;text-align: center;">
            <img src="img/a1.jpg" style="vertical-align: middle;display:inline-block;margin-top:20px" />
        </div>
        -->
        <div class="m-b-md">
            <img alt="image" style="height: 200px;width: 200px;" class="img-circle circle-border" src="{{asset('dealer/img/avartar.png')}}">
        </div>

        <h2 style="margin:20px 0">经销商管理后台</h2>

        <form class="m-t" role="form" action="index.html">
            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
            <div class="form-group">
                <input type="text" id="account" name="account" class="form-control" placeholder="手机号" required="">
            </div>
            <div class="form-group">
                <input type="password" id="password" name="password" class="form-control" placeholder="密码" required="">
            </div>
            <div>
                <button type="button" id="sub" class="btn btn-primary m-b m-r" style="width:120px">登 录</button>
                <button type="reset" class="btn btn-default m-b m-l" style="width: 120px">取 消</button>
            </div>
        </form>
    </div>
</div>


</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:18:23 GMT -->

</html>

<script src="{{asset('dealer/js/jquery.min.js')}}"></script>
<script src="{{asset('dealer/js/bootstrap.min.js')}}"></script>
<script type="text/javascript" src="{{asset('lib/layer/2.4/layer.js')}}"></script>

<script>
    $(document).ready(function() {
        $('#sub').on('click', function () {
            var account  = $('#account').val();
            var password = $('#password').val();
            var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
            if ( !account ) {
                // layer.msg('账号必须填写', {icon: 2});
                $('#account').focus();
            }else if(!myreg.test(account)){
                layer.msg('请输入有效的手机号', {icon: 2});
                $('#account').focus();
                return false;
            }else if ( !password ) {
                // layer.msg('密码必须填写', {icon: 2});
                $('#password').focus();
            } else {
                $.ajax({
                    method: "POST",
                    url: "loginOperation",
                    data: {"account": account, "password": password,'_token':'{{csrf_token()}}'},
                    dataType: "json ",
                    success:function (result) {

                        if ( result == '200' ) {
                            layer.msg('登陆成功', {icon: 1});
                            var t = setInterval(function() {
                                window.location.href="defaultContent";
                                clearInterval(t);
                            },2000);
                        } else if ( result == '800' ) {
                            layer.msg('账号密码错误', {icon: 2});
                            return false;
                        } else {
                            layer.msg('登录失败，请重试！', {icon: 2});
                            return false;
                        }
                    }
                });
            }
        });
    });
</script>